﻿using System.ComponentModel;
using IMDBApi.Implementation.Properties;

namespace IMDBApi.Implementation.Models
{
    /// <summary>
    /// ...
    /// </summary>
    public class MovieFile
    {
        public MovieFile(string fullname, string filename, string extension, string path, DownloadState state = DownloadState.Missing)
        {
            this.Fullname = fullname;
            this.Filename = filename;
            this.Extension = extension;
            this.Path = path;
            this.State = state;

            ChangeState(state);
        }

        [DisplayName("JSON Filename")]
        [Browsable(false)]
        public string JSONFullname { get; set; }

        [DisplayName("JSON Data")]
        public System.Drawing.Image Image { get; set; }

        [DisplayName("State")]
        public DownloadState State { get; set; }

        [DisplayName("Filename")]
        public string Filename { get; set; }

        [DisplayName("Extension")]
        public string Extension { get; set; }

        [DisplayName("Path")]
        public string Path { get; set; }

        [DisplayName("Fullname")]
        [Browsable(false)]
        public string Fullname { get; set; }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="state"></param>
        public void ChangeState(DownloadState state)
        {
            this.State = state;

            switch (state)
            {
                case DownloadState.Missing:
                    this.Image = Resources.inbox_empty;
                    break;
                case DownloadState.Downloading:
                    this.Image = Resources.inbox_download;
                    break;
                case DownloadState.Local:
                    this.Image = Resources.inbox_film;
                    break;
                default:
                    this.Image = Resources.inbox_empty;
                    break;
            }
        }
    }
}
